package com.situ.mall.controller;

import com.situ.mall.pojo.entity.Category;
import com.situ.mall.service.ICategoryService;
import com.situ.mall.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private ICategoryService categoryService;

    @RequestMapping("/selectTopCategory")
    public Result selectTopCategory() {
        List<Category> list = categoryService.selectTopCategory();
        return Result.ok(list);
    }

    @RequestMapping("/selectSecondCategoryByTopCategoryId")
    public Result selectSecondCategoryByTopCategoryId(Integer id) {
        List<Category> list = categoryService.selectSecondCategoryByTopCategoryId(id);
        return Result.ok(list);
    }
}
